<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        console.log("用户代理："+navigator.userAgent);
        //每五个组成一个数组
        var spArray = function (N, Q) {
            var R = [],
                F;
            for (F = 0; F < Q.length;) {
                R.push(Q.slice(F, F += N))
            }
            return R
        }
        var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
        console.log(spArray(5, arr));
        console.log(1);
        //根据一个数组，过滤出另一个数组
        var aim = [
                    {name:'Anne', age: 23, gender:'female'},
                    {name:'Leila', age: 16, gender:'female'},
                    {name:'Jay', age: 19, gender:'male'},
                    {name:'Mark', age: 40, gender:'male'}
                ]
                var nameArr=['Leila','Jay']
                // 根据多个名字筛选
                function filterByName1(aim, nameArr) {
                    let newArray = []
                    aim.forEach(item => {  //遍历arr
                      //此处如果需要留下重复元素,则将!去掉即可
                      //arr中的元素如果在ids中不存在,则添加到新数组中
                          if (!nameArr.includes(item.name)) { 
                              newArray.push(item); 
                          };
                      })
                    return newArray
                }
                
                console.log(filterByName1(aim,nameArr))
    </script>
</body>

</html>